	function formatOrder(value, rowData, rowIndex) {
		return rowIndex+1;
	}

	/**
	 * 详情页
	 */
	function detail(id) {
	    var dialogId = "detailDialog";
	    var detail = new CommonDialog(dialogId, "500", "300",
	        "platform/cbb/MyMessageController/toDetailJsp?id=" + id + "&dialogId=" + dialogId,
	        commonLang.dialog.detailPage, false, true,false);
	    detail.show();
	    changeReadById(id);
	}

	/**
	 * 设置fitColNumber属性
	 */
	function setFitColumns(iframeWidth, myColNumbers) {
	    var colNumber = Math.floor((iframeWidth - 50) / 100);
	    if (myColNumbers > colNumber) {
	        $('#inBoxDataGrid').datagrid({
	            fitColumns: false,
	            url: 'platform/cbb/MyMessageController/getInboxData.json?sysId=' + sysId
	        });
	    } else {
	        $('#inBoxDataGrid').datagrid({
	            fitColumns: true,
	            url: 'platform/cbb/MyMessageController/getInboxData.json?sysId=' + sysId
	        });
	    }
	}

	/**
	 * 格式化详细列
	 * @param value
	 * @param row
	 * @param index
	 * @returns {String}
	 */
	function formatHref(value, row, index) {
		// SanXiaFiles Create By  Tangkun start  
		if(row.messStatus=='未读'){
			return "<a onclick=detail('" + row.ID + "'); href='javascript:void(0);' style='color:red;'>"+row.MESS_TITLE+ "</a>";
			// SanXiaFiles Create By  Tangkun End
		}else{
			return "<a onclick=detail('" + row.ID + "'); href='javascript:void(0);' style='color:#808080;'>"+row.MESS_TITLE+ "</a>";
			// SanXiaFiles Create By  Tangkun End
		}
		
	}
	/**
	 * 格式化回复列
	 * @param value
	 * @param row
	 * @param index
	 * @returns {String}
	 */
	function formatHref2(value, row, index) {
		//alert(3);
	    return "<a onclick=reply('" + row.ID + "'); href='javascript:void(0);'>"+commonLang.dialog.reply+ "</a>";
	}

	/**
	 * 跳转到回复页
	 */
	function reply(id) {
	    var dialogId = "replyDialog";
	    var transmit = new CommonDialog(dialogId, "800", "400",
	        "platform/cbb/MyMessageController/toReplyJsp?id=" + id + "&dialogId=" + dialogId + "&sysId=" + sysId,
	        commonLang.dialog.reply, false, true, false);
	    transmit.show();
	}

	/**
	 *删除记录
	 *
	 *commonLang.tip.pleaseConfirm请确认
	 *commonLang.tip.confirmDelete您确定要删除当前所选的记录？
	 *commonLang.tip.alert 提示  
	 *commonLang.optip.deleteSuccess, 删除成功！
	 *commonLang.tip.pleaseSelectRecord 请选择要删除的记录！
	 */
	function deleteForm() {
	    var rows = myDatagrid.datagrid('getSelections');
	    var ids = [];
	    if (rows.length > 0) {
	        $.messager.confirm(
	        		commonLang.tip.pleaseConfirm,
	        		commonLang.tip.confirmDelete,
	            function(b) {
	                if (b) {
	                    for (var i = 0, length = rows.length; i < length; i++) {
	                        ids.push(rows[i].ID);
	                    }
	                    $.ajax({
	                        url: 'platform/cbb/MyMessageController/deleteMessage',
	                        data: {
	                            ids: ids.join(',')
	                        },
	                        type: 'post',
	                        dataType: 'json',
	                        success: function(result) {
	                            if (result.flag == "success") {
	                                myDatagrid.datagrid(
	                                    'reload', {});
	                                $.messager.show({
	                                    title:commonLang.tip.alert,
	                                    msg: commonLang.optip.deleteSuccess,
	                                    timeout: 2000,
	                                    showType: 'slide'
	                                });
	                            }
	                        }
	                    });
	                }
	            });
	    } else {
	        $.messager.alert(commonLang.tip.alert, commonLang.tip.pleaseSelectRecord, 'warning');
	    }
	}

	/**
	 * 设为已读
	 * 
	 * commonLang.tip.alert 提示
	 * commonLang.tip.readStateExist 存在已读状态消息，不允许置为已读！
	 * commonLang.optip.setSuccess 设置成功！
	 * commonLang.tip.selectRecord 请选择要置为已读的记录！
	 */
	function setRead() {
	    var rows = myDatagrid.datagrid('getSelections');
	    var ids = [];
	    if (rows.length > 0) {
	        if (rows.length > 0) {
	            for (var i = 0, length = rows.length; i < length; i++) {
	                if (rows[i].messStatus == "已读") {
	                    // $.messager.alert(commonLang.tip.alert, '请选择要置为未读的记录！', 'warning');
	                    // return;
	                }else {
						ids.push(rows[i].ID);
					}
	            }
	        }

	        $.ajax({
	            url: 'platform/cbb/MyMessageController/setRead',
	            data: {
	                ids: ids.join(',')
	            },
	            type: 'post',
	            dataType: 'json',
	            success: function(result) {
	                if (result.flag == "success") { 
	                    myDatagrid.datagrid(
	                        'reload', {});
						top.getMessageCount();
	                    if (rows.length > 0) {
	                        parent.parent.parent.$.messager.show({
	                            title: commonLang.tip.alert,
	                            msg: '设置成功！',
	                            timeout: 2000,
	                            showType: 'slide'
	                        });
	                    }
	                }
	            }
	        });
	    } else {
	        $.messager.alert(commonLang.tip.alert, '请选择要置为已读的记录！', 'warning');
	    }
	}


	/**
	 * 置为已读
	 */
	function changeReadById(id) {
	    $.ajax({
	        url: 'platform/cbb/MyMessageController/setRead',
	        data: {
	            ids: id
	        },
	        type: 'post',
	        dataType: 'json',
	        success: function(result) {
	            if (result.flag == "success") {
	                myDatagrid.datagrid(
	                    'reload', {});
					top.getMessageCount();
	                /*$.messager.show({
	                			title : '提示',
	                			msg : "设置成功！",
	                			timeout : 2000,
	                			showType : 'slide'
	                		});*/
	            }
	        }
	    });
	}

	/**
	 *设为未读
	 *
	 *commonLang.tip.alert 提示
	 *commonLang.tip.notAllow 存在未读状态消息，不允许置为未读！
	 *commonLang.optip.setSuccess 设置成功！
	 *commonLang.tip.selectRecord 请选择要置为未读的记录！
	 */
	function setUnRead() {
	    var rows = myDatagrid.datagrid('getSelections');
	    var ids = [];
	    if (rows.length > 0) {
	        for (var i = 0, length = rows.length; i < length; i++) {
	            if (rows[i].messStatus == "未读") {
	                $.messager.alert(commonLang.tip.alert, commonLang.tip.notAllow, 'warning');
	                return;
	            }
	            ids.push(rows[i].ID);
	        }
	        $.ajax({
	            url: 'platform/cbb/MyMessageController/setUnRead',
	            data: {
	                ids: ids.join(',')
	            },
	            type: 'post',
	            dataType: 'json',
	            success: function(result) {
	                if (result.flag == "success") {
	                    myDatagrid.datagrid(
	                        'reload', {});
	                    $.messager.show({
	                        title: commonLang.tip.alert,
	                        msg: commonLang.optip.setSuccess,
	                        timeout: 2000,
	                        showType: 'slide'
	                    });
	                }
	            }
	        });
	    } else {
	        $.messager.alert(commonLang.tip.alert, commonLang.tip.selectRecord, 'warning');
	    }
	}

	/**
	 * 执行查询方法
	 * 
	 */
	queryForm = function() {
	    var title = $('#title').val();
	    var isRead = $('#isRead').combobox('getValue');
	    if (title != "" && title != null) {
	        title = encodeURI(title);
	    }

	    var url = "platform/cbb/MyMessageController/getInboxData.json?sysId=" + sysId + "&title=" + title + "&isRead=" + isRead;
	    myDatagrid.datagrid("options").url = url;
	    myDatagrid.datagrid('load', {
	        param: null
	    });
	};

	/**
	 * 重置查询框
	 * 
	 */
	clearQueryForm = function() {
	    $('#title').val('');
	    $('#isRead').combobox('setValue', '');
	};

	/**
	 * 提示操作成功并重新加载数据
	 */
	function reload() {
	    myDatagrid.datagrid(
	        'reload', {});
	    $.messager.show({
	    	//title: '提示',
	        title: commonLang.tip.alert,
	        // msg: "操作成功！",
	        msg: commonLang.optip.operateSuccess,
	        timeout: 2000,
	        showType: 'slide'
	    });
	}

	/**
	 * 格式化置为已读列
	 * @param value
	 * @param row
	 * @param index
	 * @returns {String}
	 */
	function formatHref3(value, row, index) {
	    if (row.MESS_STATUS == 'N') {
	        return "<a onclick=setReadById('" + row.ID + "'); href='javascript:void(0);'>"+commonLang.dialog.setRead+ "</a>";
	    } else if (row.MESS_STATUS == 'Y') {
	        return "<a onclick=setUnReadById('" + row.ID + "'); href='javascript:void(0);'>" +commonLang.dialog.setUnread+ "</a>";
	    }
	}

	/**
	 * 置为已读
	 */
	function setReadById(id) {
	    $.ajax({
	        url: 'platform/cbb/MyMessageController/setRead',
	        data: {
	            ids: id
	        },
	        type: 'post',
	        dataType: 'json',
	        success: function(result) {
	            if (result.flag == "success") {
	                myDatagrid.datagrid(
	                    'reload', {});
	                $.messager.show({
	                	//title: '提示',
	                    title: commonLang.tip.alert,
	                    //msg: "设置成功！",
	                    msg: commonLang.optip.setSuccess,
	                    timeout: 2000,
	                    showType: 'slide'
	                });
	            }
	        }
	    });
	}

	/**
	 * 置为未读
	 */
	function setUnReadById(id) {
	    $.ajax({
	        url: 'platform/cbb/MyMessageController/setUnRead',
	        data: {
	            ids: id
	        },
	        type: 'post',
	        dataType: 'json',
	        success: function(result) {
	            if (result.flag == "success") {
	                myDatagrid.datagrid(
	                    'reload', {});
	                $.messager.show({
	                	//title: '提示',
	                    title: commonLang.tip.alert,
	                    //msg: "设置成功！",
	                    msg: commonLang.optip.setSuccess,
	                    timeout: 2000,
	                    showType: 'slide'
	                });
	            }
	        }
	    });
	}

	function formatFHS(){
		return "系统消息";
	}